// 聊天相关类型定义

export interface ChatItem {
  id: string
  title: string
  lastMessage: string
  lastMessageType: 'text' | 'image'
  messageCount: number
  isPinned: boolean
  createdAt: string
  updatedAt: string
}

export interface ChatMessage {
  id: string
  chatId: string
  role: 'user' | 'assistant'
  content: string
  type: 'text' | 'image'
  imageUrl?: string
  imagePrompt?: string
  createdAt: string
}

export interface UserStats {
  messageCount: number
  imageCount: number
  monthlyUsage: {
    textMessages: number
    imageGenerations: number
    totalTokens: number
  }
  limits: {
    maxTextMessages: number
    maxImageGenerations: number
    maxTokens: number
  }
}

export interface ChatCreateRequest {
  title?: string
  type: 'text' | 'image'
  initialMessage?: string
}

export interface ChatUpdateRequest {
  title?: string
  isPinned?: boolean
  lastMessage?: string
  lastMessageType?: 'text' | 'image'
  messageCount?: number
}

export interface ChatExportData {
  id: string
  title: string
  messages: ChatMessage[]
  createdAt: string
  updatedAt: string
  metadata: {
    messageCount: number
    totalTokens: number
    exportedAt: string
  }
}

export interface ChatListResponse {
  chats: ChatItem[]
  total: number
  hasMore: boolean
  nextCursor?: string
}

export interface ChatResponse {
  chat: ChatItem
}

export interface UserStatsResponse {
  stats: UserStats
}

export interface ChatExportResponse {
  data: ChatExportData[]
  exportedAt: string
  format: 'json' | 'markdown' | 'txt'
}
